<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title></title>
	<link rel="stylesheet" type="text/css" href="${path}/css/main.css">
	<link rel="stylesheet" type="text/css" href="${path}/css/mainTable.css">
	<script type="text/javascript">
		function remove(id,sp_number){
			if(confirm("删除后无法恢复!你确定要删除吗?")){
				var actionUrl = "${path}/router/deleteRouter.action";
				var params = "routerVo.id="+id+"&routerVo.sp_number="+sp_number;
				params = encodeURI(params);
				params = encodeURI(params);
				window.location.href=actionUrl+'?'+params;
			}
		}
	</script>
  </head>
  <body>
    <div>
    	<p>新增路由信息 <a href="${path }/router/addRouter.action" title="新增路由 ">添加</a></p>
    	<div>
    		<table>
    			<thead>
    				<tr>
    					<th>编号</th>
    					<th>路由名称</th>
    					<th>业务长号码</th>
    					<th>路由地址</th>
    					<th>渠道名称</th>
    					<th>详情</th>
    					<th>操作</th>
    				</tr>
    			</thead>
    			<c:choose>
    				<c:when test="${routerVoList != null && fn:length(routerVoList) > 0}">
    					<c:forEach var="routerVo" items="${routerVoList }" varStatus="list">
    						<tr style="${list.index%2 != 0 ? 'background-color: #fea;' : 'background-color: #fff;' }">
    							<td>${routerVo.id }</td>
    							<td>
    								<a href="${path }/router/editRouter.action?routerVo.id=${routerVo.id }">${routerVo.name }</a>
    							</td>
    							<td>${routerVo.sp_number }</td>
    							<td>${routerVo.sync_url }</td>
    							<td>
    								<c:if test="${partnerLowerVoList != null && fn:length(partnerLowerVoList) > 0 }">
    									<c:forEach items="${partnerLowerVoList }" var="partnerLowerVo" varStatus="i">
    										<c:if test="${partnerLowerVo.id == routerVo.lower_id }">${partnerLowerVo.name }</c:if>
    									</c:forEach>
    								</c:if>
    							</td>
    							<td>${routerVo.detail }</td>
    							<td>
    								<a href="javascript:remove(${routerVo.id },'${routerVo.sp_number }');">删除</a>
    							</td>
    						</tr>
    					</c:forEach>
    				</c:when>
    				<c:otherwise>
    					<tr>
    						<td>暂无路由信息<td>
    					</tr>
    				</c:otherwise>
    			</c:choose>
    		</table>
    	</div>
    </div>
  </body>
</html>
